import {onBeforeUnmount, onMounted, ref} from 'vue'
export default function () {
	const x = ref(-1) ; // x 绑定为响应式数据
	const y = ref(-1);
	const clickHandler=(event)=>{
		x.value = event.pageX
		y.value = event.pageY
	}
	onMounted(()=>{
		window.addEventListener('click', clickHandler)
	})
	onBeforeUnmount(()=>{
		window.removeEventListner('click', clickHandler)
	})
	return {
		x,
		y
	}
}
